how to solve day 30 contest in hackerrank